package org.microservice.system.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.microservice.common.entity.SysZuulRoute;
import org.microservice.system.dao.SysZuulRouteDao;
import org.microservice.system.service.SysZuulRouteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: 齐丹枫
 * Date: 2018/6/25
 * Time: 8:44
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class SysZuulRouteServiceImpl extends ServiceImpl<SysZuulRouteDao,SysZuulRoute> implements SysZuulRouteService{
    @Autowired
    private SysZuulRouteDao sysZuulRouteDao;




    @Override
    public List<SysZuulRoute> getBydelFlag(boolean delFlag) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("del_flag",delFlag);
        List<SysZuulRoute> routes = sysZuulRouteDao.selectByMap(map);
        return routes;
    }

    @Override
    public List<SysZuulRoute> getZuulRouteListPage(Map<String, Object> params) {
        Page<SysZuulRoute> page = new Page<>(((Integer) params.get("page")), ((Integer) params.get("limit")));


        List<SysZuulRoute> list = sysZuulRouteDao.selectPage(page, new EntityWrapper<SysZuulRoute>());

        return list;
    }


    @Override
    public int getZuulRouteListPageTotal(Map<String, Object> params) {

        Integer integer = sysZuulRouteDao.selectCount(new EntityWrapper<SysZuulRoute>());

        return integer;
    }
}
